package gof_001_创建型_Create.gof_001_单例_Singleton.gof_002_Hungry;

public class HungryMain {
    public static void main(String[] args) {
        Student s1 = Student.getInstance();
        Student s2 = Student.getInstance();

        //因为 Student 是单例,所以每次创建的对象都是相同的对象
        System.out.println("s1 = " + s1);   //s1 = gof_01_Create.gof_001_Singleton.gof_002_Hungry.Student@1b6d3586
        System.out.println("s2 = " + s2);   //s2 = gof_01_Create.gof_001_Singleton.gof_002_Hungry.Student@1b6d3586
    }
}
